
import { RootObject,ResGoodsListData } from '../types/category'
import {instanceS, instanceW} from '../utils/request'


//    推选好物接口

export const reqChooseList =(id:number)=>{

  return instanceW.get(`item/cateList.json?__timestamp=1630131286110&categoryId=${id}`)
}
export const reqPhoneList=(id:number)=>{
  return  instanceS.get(`api/item/${id}`)
}

// 加入购物车
// skuId:any,skuNum:any
 export  const reqAddToCart=(skuId: any,skuNum: any)=>{
  
  return instanceS.post(`api/cart/addToCart/${skuId}/${skuNum}`)
 }

 export  const reqAcartList =()=>{
  return instanceS.get('api/cart/cartList')
 }


/* 获取分类商品数据信息 */
export const reqGoodsList = (id:any) => {
  return instanceW.get<any,RootObject>(`/item/list.json?categoryId=${id}`)
}

/* 获取二级分类的商品数据 */
export const reqCategoryGoods = (id:any,subId:any) => {
  return instanceW.get<any,ResGoodsListData>(`/item/list.json?&subCategoryId=${subId}&categoryId=${id}`)
}